﻿// MIT License
// 开源地址：https://gitee.com/co1024/AbcMvc
// Copyright (c) 2021-2023 1024
// Abc.Mvc=Furion+EF+SqlSugar+Pear layui admin.

namespace Abc.Application;

public class ApiLoginInput
{
    ///<Summary>
    /// UserName
    ///</Summary>
    //[Required(ErrorMessage = "账号不能为空"), MinLength(4, ErrorMessage = "账号长度不能小于4位"), MaxLength(15, ErrorMessage = "账号长度不能超过15")]
    [RegularExpression("[a-zA-Z0-9_@]{4,20}", ErrorMessage = "账号长度为4~15,且只能是数字大小写字母、下划线、@")]   // 正则表达式验证
    public string Account { get; set; }

    ///<Summary>
    /// PassWord
    ///</Summary>
    //[Required]    // 必填验证
    //[RegularExpression("[a-zA-Z0-9~!@#$%^&*()_+.]{6,20}", ErrorMessage = "密码长度在6~20，且只能是数字、英文大小写、以及这些字符：~!@#$%^&*()_+.")]    // 正则表达式验证
    [Required(ErrorMessage = "请输入密码"), MaxLength(1000, ErrorMessage = "密码输入错误")]
    public string PassWord { get; set; }

    //public string RePassWord { get; set; }

    //protected override ValidationResult IsValid(object value, ValidationContext validationContext)
    //{
    //    var movie = (Movie)validationContext.ObjectInstance;
    //    var releaseYear = ((DateTimeOffset)value).Year;

    //    if (movie.Genre == Genre.Classic && releaseYear > Year)
    //    {
    //        return new ValidationResult(GetErrorMessage());
    //    }

    //    return ValidationResult.Success;
    //}

    /// <summary>
    /// 记住密码
    /// </summary>
    public bool Remember { get; set; }

    /// <summary>
    /// 验证码
    /// </summary>
    [Required(ErrorMessage = "验证码不能为空")
    , MinLength(4, ErrorMessage = "验证码错误")
    , MaxLength(10, ErrorMessage = "验证码错误")]
    public string VerifyCode { get; set; }
}